home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 247_02 / roots.c < prev    next >
Text File  |  1989-04-17  |  640b  |  28 lines

  1. /*
  2.  * Program to calculate roots
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include "miracl.h"
  7.  
  8. main()
  9. { /* Find roots */
  10.     flash x,y;
  11.     int n;
  12.     mirsys(-45,MAXBASE);
  13.     x=mirvar(0);
  14.     y=mirvar(0);
  15.     POINT=ON;
  16.     printf("enter number\n");
  17.     cinnum(x,stdin);
  18.     printf("to the power of 1/");
  19.     scanf("%d",&n);
  20.     getchar();
  21.     froot(x,n,y);
  22.     cotnum(y,stdout);
  23.     fpower(y,n,x);
  24.     printf("to the power of %d = ",n);
  25.     cotnum(x,stdout);
  26.     if (EXACT) printf("Result is exact!\n");
  27. }
  28.